/*
 * Command.cpp
 *
 *  Created on: 2014. 6. 25.
 *      Author: jjaehuny
 */

#include "Command.h"

#include "../Memory/Lock_Function_new_Pool.h"
#include "../Memory/Function_new_Pool.h"

namespace Framework { namespace Database {

::Framework::Memory::Lock_Function_new_Pool<::Framework::Database::Command> s_clsCommand_LockFunctionNewPool;
::Framework::Memory::Lock_Function_new_Pool<::Framework::Database::Command> s_clsCommand_FunctionNewPool;

std::shared_ptr<::Framework::Database::Command> create_command_multithread()
{
	return s_clsCommand_LockFunctionNewPool.NEW();
}

std::shared_ptr<::Framework::Database::Command> create_command_singlethread()
{
	return s_clsCommand_FunctionNewPool.NEW();
}

} /*Database*/ } /*Framework*/




namespace Framework { namespace Database {

Command::Command()
: isSuccess_(false)
, resultSet_(NULL)
, OnResponse_(NULL)
, query_type_(-1)
{
	// TODO Auto-generated constructor stub

}

Command::~Command()
{
	// TODO Auto-generated destructor stub
}

void
Command::Initialize()
{
	//stream_.erase();
	isSuccess_ = false;
	query_.clear();
	OnResponse_ = NULL;
	query_type_ = -1;
}

void
Command::Finalize()
{
	LOG(INFO) << __PRETTY_FUNCTION__;
	SAFE_DELETE(resultSet_);
}

std::shared_ptr<Command>
Command::CAPTURE()
{
	return shared_from_this();
}

} /*Database*/ } /*Framework*/

